package com.yuexun.beilunpatient.ui.doctor.model.impl;

import com.yuexun.beilunpatient.base.BaseEntity;
import com.yuexun.beilunpatient.ui.doctor.api.DoctorApi;
import com.yuexun.beilunpatient.ui.doctor.bean.CollectionDocInfoBean;
import com.yuexun.beilunpatient.ui.doctor.bean.SeeDocInfoBean;
import com.yuexun.beilunpatient.ui.doctor.bean.SignDocInfoBean;
import com.yuexun.beilunpatient.ui.doctor.model.IDoctorModel;
import com.yuexun.beilunpatient.utils.ApiUtil;

import java.util.Map;

import rx.Observable;

/**
 * Created by chenss on 2018/12/4.
 */
public class DoctorModel implements IDoctorModel {

    private DoctorApi api;

    public DoctorApi ApiInstance() {
        if (api != null) {
            return api;
        } else {
            return ApiUtil.getInstance().createRetrofitApi(DoctorApi.class);
        }
    }

    @Override
    public Observable<BaseEntity<SeeDocInfoBean>> inquireHaveSeeDoctorList(Map<String, String> praise) {
        api = ApiInstance();
        return api.inquireHaveSeeDoctorList(praise);
    }

    @Override
    public Observable<BaseEntity<SignDocInfoBean>> inquireContractedPatientSignDocInfo(Map<String, String> praise) {
        api = ApiInstance();
        return api.inquireContractedPatientSignDocInfo(praise);
    }

    @Override
    public Observable<BaseEntity<CollectionDocInfoBean>> inquireCollectionDoctorPageList(Map<String, String> praise) {
        api = ApiInstance();
        return api.inquireCollectionDoctorPageList(praise);
    }

    @Override
    public Observable<BaseEntity<String>> deleteCollectionDoctor(Map<String, String> praise) {
        api = ApiInstance();
        return api.deleteCollectionDoctor(praise);
    }

    @Override
    public Observable<BaseEntity<String>> addCollectionDoctor(Map<String, String> praise) {
        api = ApiInstance();
        return api.addCollectionDoctor(praise);
    }
}
